<template>
   <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>登录</span>
        </div>
        <div class="text item" >
        <el-form
          :model="loginObj" 
          status-icon
          ref="ruleForm"
          label-width="100px"
        >
          <el-form-item label="用户名">
            <el-input type="text" v-model="loginObj.name"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input
              type="pwd"
              v-model="loginObj.pwd"
              autocomplete="off"
            ></el-input>
          </el-form-item>
         
          <el-form-item>
            <el-button type="primary" @click="login"
              >提交</el-button
            >
            <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
            <!-- <a href="https://gitee.com/oauth/authorize?client_id=94f6b74c0d861413dc5b583372ad4a62ac62378a1fc3f00c61e47c6f894df324&redirect_uri=http://localhost:8086/project/oauth/process&response_type=code
">gitee</a><br>
           <a href="https://developer.baidu.com/wiki/index.php?client_id=tSeMC0R1mMFpKgIAlnGaexQz&redirect_uri=http://localhost:8086/project/baidu/auth&response_type=code
">baidu</a><br> -->
          </el-form-item>
        </el-form>
        </div>
      
    </el-card>
  </div>
</template>

<script>
import {mapMutations} from "vuex"
export default {
    data(){
      return{
        loginObj:{},
      }
    },
    methods:{
      ...mapMutations("loginjs",["setLoginUser"]),
      async login(){
        var info = await this.ajax.postSubmit("/project/user/login",{name:this.loginObj.name,pwd:this.loginObj.pwd});
        // console.log(info)
        if(info.length != 0){
          // console.log(info.data);  
          // alert(info.data);
        // this.$cookies.set("token",info.data);
          this.$router.push("/AppOne") 
          // alert("登陆成功")
        }else{
          alert("登陆失败")
        }
      }
    }
}
</script>

<style>

</style>